#include <iostream>
#include <string>

using namespace std;
class Complex
{
private:
	double real;
	double imag;

public:
	Complex()
		: real(0), imag(0)
	{
	}

	Complex(double real, double imag) : real(real), imag(imag)
	{
	}
	~Complex()
	{
	}

public:
	// 显示
	void Show()
	{
		cout << "实部" << real << "虚部" << imag << endl;
	}
	// 递增运算符 前置++ 的重载
	Complex operator++()
	{
		
		++this->real;
		++this->imag;
		return *this;
	}
	// 递增运算符 后置++ 的重载  需要用到占位符 区分前置和后置
	Complex operator++(int)
	{
		// 把当前这个类的成员属性赋值给temp 用于返回
		Complex temp = *this;
		// 将当前这个类的实部和虚部加加
		++this->real;
		++this->imag;
		return temp;
	}
};

int main(int argc, char const *argv[])
{
	// 示例对象 并初始化
	Complex F1(3, 4);
	Complex F2;

	// 前置加加
	F2 = ++F1;
	cout << "前置加加加" << endl;
	F1.Show();
	F2.Show();
	Complex F3(1,2);
	Complex F4;
	cout << "后置加加加" << endl;
	F4 = F3++;
	F3.Show();
	F4.Show();

	return 0;
}
